import com.lishanyang.spring.demo.HelloWorld;
import com.lishanyang.spring.biz.UserBiz;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestMain {
    public static void main(String[] args){
        ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
        UserBiz userBiz=(UserBiz)context.getBean("userBiz");
        UserBiz userBiz02=(UserBiz)context.getBean("userBiz");
        boolean flag=userBiz.login("admin","123456");
        boolean flag02=userBiz==userBiz02;

        HelloWorld helloWorld01=(HelloWorld)context.getBean("hw");
        HelloWorld helloWorld02=(HelloWorld)context.getBean("hw");
        boolean flag03=helloWorld01==helloWorld02;
        System.out.println(flag03);

        if(flag && flag02){
            System.out.println("登入成功");
        }else {
            System.out.println("登入失败");
        }

        UserBiz userBizByAOR=(UserBiz)context.getBean("userBizByAOR");
        boolean flag04=userBizByAOR.login("admin","123456");
        if(flag04){
            System.out.println("userBizByAOR登入成功");
        }else {
            System.out.println("userBizByAOR登入失败");
        }
    }

}
